//
//  Const.swift
//  shopAssistant
//
//  Created by 周文杰 on 16/9/6.
//  Copyright © 2016年 com.weitaming. All rights reserved.
//

import UIKit

func RGBA(r: CGFloat, g: CGFloat, b: CGFloat, a: CGFloat) -> UIColor {
    return UIColor.init(red:r/255.0,
                        green:g/255.0,
                        blue:b/255.0,
                        alpha:a) }

func WTMLocalize(_ key: String) -> String {
    return NSLocalizedString(key, tableName:"WTMLocalizable", comment:key)
}

class Const: NSObject {
    
    static let COLOR_GRAY = RGBA(r: 0x7a, g: 0x7a, b: 0x7a, a: 1.0)
    //colors
    static let CAMERA_GRAY      = RGBA(r:0x38, g:0x3c, b:0x3f, a:1.0) //#383c3f, color same to the camera
    static let TABBAR_GRAY      = RGBA(r:0x3c, g:0x38, b:0x3f, a:1.0)
    static let WTM_BLACK        = RGBA(r:0x3c, g:0x3c, b:0x3c, a:1.0) //#00D1C0
    static let WTM_GREEN        = RGBA(r:0x00, g:0xd1, b:0xc0, a:1.0) //#00D1C0
    static let WTM_PINK         = RGBA(r:0xfe, g:0x00, b:0x78, a:1.0) //#fe0078
    static let WTM_WHITE_SMOKE  = RGBA(r:0xF5, g:0xF5, b:0xF5, a:1.0) //#F5F5F5
    static let WTM_GRAY_FONT  = RGBA(r:0x66, g:0x66, b:0x66, a:1.0) //#F5F5F5
    static let WTM_SILVER       = RGBA(r:0xC0, g:0xC0, b:0xC0, a:1.0) //#C0C0C0
    static let WTM_GRAY         = RGBA(r:0xA0, g:0xA0, b:0xA0, a:1.0) //#A0A0A0
    static let WTM_LIGHTGRAY    = RGBA(r:0xD7, g:0xD7, b:0xD7, a:1.0) //#D7D7D7
    static let WTM_F5F5F5       = WTM_WHITE_SMOKE
    static let WTM_C0C0C0       = WTM_SILVER
    static let WTM_A0A0A0       = WTM_GRAY
    static let WTM_D7D7D7       = WTM_LIGHTGRAY
    static let WTM_background_gray       = RGBA(r: 0xF0, g: 0xEF, b: 0xEB, a: 1.0) //#ECECEC, DEFAULT_GRAY
//    static let TINTCOLOR        = RGBA(r:0x62, g:0x62, b:0x62, a:1.0) //#626262
    
    static let ALERT_TINT_COLOR = RGBA(r: 0x18, g: 0x84, b: 0xf9, a: 1)
    static let UITextFieldPlaceHolderTextColor = RGBA(r: 0xC7, g: 0xC7, b: 0xCD, a: 1.0)
    
    //sizes
    static let SCREEN_WIDTH                 = UIScreen.main.bounds.size.width
    static let SCREEN_HEIGHT                = UIScreen.main.bounds.size.height
    static let ONE_PIXEL                    = 1 / UIScreen.main.scale
    static let WIDTH_RATIO                  = SCREEN_WIDTH/320
    static let NAVIGATIONBAR_HEIGHT         = CGFloat(44)
    static let STATUSBAR_HEIGHT: CGFloat    = 20
    static let TOPHEIGHT: CGFloat           = 64
    static let TABBAR_HEIGHT: CGFloat       = 49
    static let SCREEN_AVAILABLE_HEIGHT      = SCREEN_HEIGHT - STATUSBAR_HEIGHT - NAVIGATIONBAR_HEIGHT
    static let LEFT_X: CGFloat              = 15//default left margin
    static let SCREEN_AVAILABLE_WIDTH       = SCREEN_WIDTH - LEFT_X*2

    static let FONT_SIZE: CGFloat           = 12
    static let kDefaultCellHeight: CGFloat  = 45
    static let kLogoInMapInsetSize: CGFloat = 2
    static let kLogoInMapSize: CGFloat      = 30
    
    static let kPayRightArrowX: CGFloat = {
        if Const.SCREEN_WIDTH >= 414 {
            return Const.SCREEN_WIDTH - 28
        }
        return Const.SCREEN_WIDTH - 22
    }()
    static let kPayRightArrowW: CGFloat = 7
    static let kPayRightArrowH: CGFloat = 12
//    static let kButtonBGW: CGFloat = 302

    static func TitleFont1() -> UIFont {
        if #available(iOS 8.2, *) {
            return UIFont.systemFont(ofSize: 17, weight: UIFont.Weight.ultraLight)
        } else {
            return UIFont.systemFont(ofSize: 17)
        }
    }
    static let DefaultFont = UIFont.systemFont(ofSize: 12)
    
    static let CurrencySymbol = "¥"

}
